//公共
import myHeader from "/pages/headerfoot/pages/header.vue"

//cache缓存
import Cache from '@/utils/cache.js';
//打帮赛方法
import hitmatchcommon from '@/common/hitmatchcommon.js';

export default {
	components: {
		myHeader,
	},
	data() {
		return {
			informationfilling: '我的奖品',
			lead:false,//领取
			page:1,//页数
			state:'',//空是全部 1 =未使用 
			prizelist:[],//奖品列表
		}
	},
	onLoad(option) {
		var that=this;
		 that.make_id=option.id;
		 that.getUserPrize();//得到赛事参赛列表
	},
	onReachBottom(){
		var that=this;
		that.page=that.page+1;
		that.getUserPrize();//得到赛事参赛列表
	},
	methods: {
		//得到赛事参赛列表
		async getUserPrize() {
			var that = this;
			var data = {};
			data['make_user_id']=Cache.get('user_id');
			data['page']=that.page;
			data['state']=that.state;
			hitmatchcommon.getUserPrizeapiLibMethod(data).then(res => {
				if (res) {
					that.prizelist = that.prizelist.concat(res);//赛事参赛列表
				}
			});
		},
		
		//是否领取
		iflead(option=''){
			var that=this;
			that.state=option;
			that.prizelist=[];//奖品列表
			//未领
			that.lead=!that.lead;
			that.getUserPrize();//得到赛事参赛列表
		},
	}
}